package Controller;

import POJO.InputPOJO.patientBodyRecordsInput;
import POJO.Model.PageResponseModel;
import POJO.Vo.patientBodyVo;
import Service.patientBodyRecordsSerivce;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller("patientBodyRecordsController")
public class patientBodyRecordsController {

    @Resource
    PageResponseModel pageResponseModel;
    @Resource
    patientBodyRecordsSerivce  patientBodyRecordsService;

    @RequestMapping("/patient/list")
    public @ResponseBody PageResponseModel patientRecords(@RequestBody patientBodyRecordsInput patientBodyRecordsInput)
    {   pageResponseModel.setNull();
        List<patientBodyVo> list=patientBodyRecordsService.paientBodyRecords(patientBodyRecordsInput);
        patientBodyRecordsInput.pagination.setTotal(patientBodyRecordsService.paientBodyRecordsTotal(patientBodyRecordsInput));
        pageResponseModel.setPagination(patientBodyRecordsInput.pagination);
        pageResponseModel.setCode(200);
        pageResponseModel.setData(list);
        return  pageResponseModel;
    }

}
